package com.szpx.service.impl;

import com.szpx.entity.Film;
import com.szpx.mapper.FilmManageMapper;
import com.szpx.service.FilmManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional //事务处理策略
public class FilmManageServiceImpl implements FilmManageService {

    @Autowired
    private FilmManageMapper filmManageMapper;
    //根据id查询影片的信息
    @Override
    public Film selectFilmById(Integer id) {
        return filmManageMapper.selectByPrimaryKey(id);
    }

    //查询所有影片的信息
    @Override
    public List<Film> selectAllFilm() {
        return filmManageMapper.selectAll();
    }

    //添加影片信息
    @Override
    public int addFilm(Film film) {
        return filmManageMapper.insertSelective(film);
    }

    //删除影片信息
    @Override
    public int deleFilm(Integer id) {
        return filmManageMapper.deleteByPrimaryKey(id);
    }

    //修改用户的信息
    @Override
    public int updateFilm(Film film) {
        return filmManageMapper.updateByPrimaryKeySelective(film);
    }

    //多条件分页模糊查询
    @Override
    public List<Film> getListByInfo(Film film) {
        return filmManageMapper.getListByInfo(film);
    }
}
